import React, { useState } from 'react';
import Casting from './components/Casting';
import CastingDetail from './components/CastingDetail';

export default () => {
  // 控制是否展示详情组件
  const [isLoadCastingDetail, setIsLoadCastingDetail] = useState(false);
  // 查看的主题的编号
  const [viewSerialNo, setViewSerialNo] = useState('');
  // 查看的主题是否有碎片
  const [isFragments, setIsFragments] = useState(0);

  return (
    <div>
      {/* CastingDetail组件 Casting铸造组件*/}
      {isLoadCastingDetail ? (
        <CastingDetail
          isFragments={isFragments}
          viewSerialNo={viewSerialNo}
          setIsLoadCastingDetail={setIsLoadCastingDetail}
        ></CastingDetail>
      ) : (
        <Casting
          setIsFragments={setIsFragments}
          setViewSerialNo={setViewSerialNo}
          setIsLoadCastingDetail={setIsLoadCastingDetail}
        ></Casting>
      )}
    </div>
  );
};
